import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "root",
    redirect : '/index',
  },{
    path: "/index",
    name: "index",
    component : () => import('../components/index'),
    redirect:'/index/',
    children:[{
      path : '',
      name: 'content',
      component : () =>import('../components/content/blogContent'),
    },{
      path : 'home',
      name: 'content-keyword',
      component : () =>import('../components/content/blogContent'),
    },
      {
        path:"detail/:code",
        name:"article-detail",
        component: () => import('../components/articleDetail/articleDetail'),
      },
      {
        path: ':cname',
        name: 'category',
        component: () => import('../components/category/category'),
      },
      {
        path: ':cname/:page',
        name: 'category-page',
        component:  () => import('../components/category/category'),
      },]
  },
  {
    path: '/admin',
    name: 'admin',
    component: ()=>import('../components/admin/index'),
    redirect:'/admin/blogInfo',
    children:[{
      path: "published",
      name: 'article-published',
      component:()=>import('../components/admin/aContent/published')
    },{
      path: "unpublished",
      name: 'article-unpublishedh',
      component:()=>import('../components/admin/aContent/unpublished')
    }, {
        path: "dustbin",
        name: 'article-unpublishedh',
        component:()=>import('../components/admin/aContent/dustbin')
      }, {
        path: "editArticle",
        name: 'article-unpublishedh',
        component:()=>import('../components/admin/aContent/editArticle')
      },{
      path: "category",
      name: 'admin-category',
      component:()=>import('../components/admin/aContent/category')
    },{
      path: "tags",
      name: 'admin-tags',
      component:()=>import('../components/admin/aContent/tags')
    },{
      path: "blogInfo",
      name: 'amdin-blogInfo',
      component:()=>import('../components/admin/aContent/blogInfo')
    },{
      path: "userInfo",
      name: 'amdin-userInfo',
      component:()=>import('../components/admin/aContent/userInfo')
    }
    ]

  },{
      path: '/login',
      name: 'login',
      component: () => import('../components/admin/login/login')
    }

];

const router = new VueRouter({
  routes,
});

export default router;
